<script lang="ts">
export default {
  name: "observationArea",
};
</script>
<template>
  <div class="page-box h100 display-flex czbj">
    <n-tabs type="line" v-model:value="tabsValue" @update:value="tabupdate">
      <n-tab :name="item.key" v-for="(item,idx) in gpTypeVue" :key="idx"> {{item.label}} </n-tab>
 
    </n-tabs>
    <FormTemplate
      url="gupiao/getGupiaoInfo"
      :columns="columns"
      :colRight="colRight"
      :obj="obj"
      ref="FormTemplateRef"
    ></FormTemplate>
    <div class="mt20 fz12 z9">
      当前价在 5日均价上多观察<br />
      dif大于0观察 大于0有上涨的趋势 但不能大太多了<br />
      <span class="red">
        失败的概率在百分之30-40左右 所以建议买3只股票 30%x40%x30%=3.6%
        按照这个程序组 操作一百次只会出现不到4次的异常</span
      ><br />
      如果在加入观察区的20个交易日 还有2面旗帜的股票可以买<br />
    </div>
  </div>
</template>
 <script lang='ts' setup>
import { h, ref, reactive } from "vue";
import comp from "../../components/index";
import FormTemplate from "../../components/details/FormTemplate";
import {gpType} from "../../util/config"
const gpTypeVue = ref()
gpTypeVue.value = gpType
let tabsValue = ref("1");
let FormTemplateRef = ref();
let obj = reactive({
  observetype: 1,
});
let columns = [];
let colRight = [
  {
    title: "加入后操作",
    width: 90,
    align: "center",
    children: [
      {
        title: "金额",
        width: 60,
        align: "center",
        key: "JRprice",
      },
      {
        title: "涨幅",
        width: 80,
        align: "center",
        sorter(row1, row2) {
           const jhsa= (row1.f2-row1.JRprice)/ row1.JRprice
           const jhsb= (row2.f2-row2.JRprice)/ row2.JRprice
    
           return jhsa - jhsb
        },
        render(data) {
          const jiaruq = data.JRprice;
          const price = data.f2;
          const totle = ((price - jiaruq) / jiaruq) * 100;
          return data.f2 == "-" ? "-" : totle.toFixed(2) + "%";
        },
      },
      {
        title: "时间",
        key: "addTime",
        width: 100,
        align: "center",
      },
    ],
  },

  {
    title: "操作",
    key: "actions",
    width: "80",
    align: "center",
    render(row) {
      return h(comp.ObserveTheMenu, {
        rowData: row,
        onCallBack: () => {
          FormTemplateRef.value.TheQueryAgain(tabsValue.value);
        },
      });
    },
  },
];
const tabupdate = (num) => {
  obj.observetype = num;
  tabsValue.value = num;
  FormTemplateRef.value.TheQueryAgain(num);
};
</script>
 <style scoped>
</style>